# 使用基础镜像
FROM quay.io/centos/centos:stream9

COPY image-data/docker-ce.repo /etc/yum.repos.d/
COPY image-data/resolv.conf /etc/

# 更新软件包并安装OpenSSH服务器
RUN dnf clean all && dnf install -y epel-release && dnf makecache && \
    dnf install -y openssh-server man-db procps-ng which git git-lfs \
		iproute docker-ce-cli-1:24.0.7-1.el9.x86_64 \
		binutils coreutils-common tmux hostname bash-completion \
        tig vim gcc gcc-c++ gdb autoconf automake make strace \
        valgrind valgrind-devel java-1.8.0-openjdk-devel maven file && \
    dnf clean all

# 生成SSH密钥对
RUN ssh-keygen -A

# SSH登录配置
RUN sed -i 's/#Port 22/Port 65522/;s/#UseDNS no/UseDNS no/' /etc/ssh/sshd_config

# 启动SSH服务
USER root
COPY image-data/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

WORKDIR /root
